1 module unde.games.dizzy.omega.animations.stone_02;
2 
3 import derelict.opengl3.gl;
4 import std.conv;
5 import std.math;
6 import std.stdio;
7 import unde.games.object;
8 import unde.games.renderer;
9 import unde.global_state;
10 
11 class Stone02:StaticGameObject
12 {    
13     StaticGameObject the_hero;
14 
15     this(MainGameObject root, StaticGameObject hero)
16     {
17         frame = -1;
18         the_hero = hero;
19 
20         models["stone-02"] = root.models["stone-02"];
21         super(root);
22     }
23 
24     override void draw(GlobalState gs)
25     {
26         if (abs(root.scrx+30.0) > 16.0 ||
27             abs(root.scry-0.0) > 9.0) return;
28             
29         float f = 0.0;   
30         if (frame >= 0.0)
31         {
32             f = root.frame - frame;
33         }
34         
35         glPushMatrix();
36         if (f <= 0.0)
37         {
38             glTranslatef(-32.8, -5.8, 0.0);
39         }
40         recursive_render(gs, models["stone-02"]);
41         glPopMatrix();
42     }
43 
44     override bool tick(GlobalState gs)
45     {
46         if (frame < 0 && false)
47         {
48             frame = root.frame;
49         }        
50         return true;
51     }
52 
53     override void load(string[string] s)
54     {
55         if ("stone-02-frame" in s)
56             frame = s["stone-02-frame"].to!(long);
57         else
58             frame = -1;
59     }
60 
61     override void save(ref string[string] s)
62     {
63         if (frame >= 0)
64             s["stone-02-frame"] = frame.to!(string);
65     }    
66 }